package com.connector.base.connection;

import com.connector.base.connection.channel.SocketChannel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;

public interface Connection<T>
{
    public static final byte STATUS_NEW = 0;
    public static final byte STATUS_CONNECTED = 1;
    public static final byte STATUS_DISCONNECTED = 2;

    void init(final SocketChannel clientChannel);

    SessionContext getSessionContext();

    void setSessionContext(final SessionContext context);

    ChannelFuture channelSend(final T t);

    ChannelFuture channelSend(final T t, final ChannelFutureListener listener);

    ChannelFuture channelClose();

    void sendEvent(final String eventName, final Object... data);

    void disConnect();

    String getId();

    boolean isConnected();

    boolean isReadTimeout();

    boolean isWriteTimeout();

    void updateLastReadTime();

    void updateLastWriteTime();

    SocketChannel getSocketClient();
}
